package com.changgou.goods.controller;

import com.changgou.goods.pojo.Category;
import com.changgou.goods.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/category")
public class CategoryController {


    @Autowired
    private CategoryService categoryService;

    /**
     * @param id
     * @return com.changgou.entity.Result<com.changgou.goods.pojo.Category>
     * @description:  根据分类id查询数据
     * @author 大佬味的小男孩
     * @date 2020/07/27 21:42
    */
    @GetMapping("/{id}")
    public Category findById(@PathVariable("id") Integer id){
        Category category = categoryService.findById(id);
        return category;
    }


}
